<template>
  <div class="newdetail-box">
    <h3 class="title-h3">{{newInfo.title}}</h3>
    <div class="time-click">
      <span>创建时间: {{newInfo.add_time | timeFilter}}</span>
      <span>点击次数: {{newInfo.click}}</span>
    </div>
    <hr>

    <div class="info-p" v-html="newInfo.content"></div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      newInfo: {}
    }
  },
  created() {
    this.getNewInfo()
  },
  methods: {
    async getNewInfo() {
      const { data: res } = await this.$http.get(`api/getnew/${this.$route.params.id}`)

      if(res.status == 1) return  this.$toast('请求失败')

      this.newInfo = res.message[0]

    }
  }
}
</script>
<style lang="less">
  .newdetail-box{
    padding: 0 5px;
    .info-p{
      font-size: 12px;
    }
    .title-h3{
      text-align: center;
      font-size: 16px;
      color: #000;
      line-height: 30px;
      margin: 0;
    }
    .time-click{
      font-size: 12px;
      display: flex;
      justify-content: space-between;
      color: #1989fa;
    }
  }
</style>